package cn.com.connext.scrm.service;

import cn.com.connext.scrm.domain.master.BrowseRecord;
import cn.com.connext.scrm.repository.master.BrowseRecordRepository;
import cn.com.connext.scrm.service.dto.BrowseRecordDTO;
import cn.com.connext.scrm.service.mapper.BrowseRecordMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class BrowseRecordService extends BaseService<BrowseRecord, String> {

    private final Logger log = LoggerFactory.getLogger(BrowseRecordService.class);

    private final BrowseRecordRepository browseRecordRepository;

    @Autowired
    private BrowseRecordMapper browseRecordMapper;

    public BrowseRecordService(BrowseRecordRepository browseRecordRepository) {
        super(browseRecordRepository);
        this.browseRecordRepository = browseRecordRepository;
    }

    public BrowseRecordDTO saveBrowseRecord(BrowseRecord browseRecord) {
        log.debug("REST to create {} : {}", getEntityName(), browseRecord);
        browseRecord = browseRecordRepository.saveAndFlush(browseRecord);
        BrowseRecordDTO result = browseRecordMapper.toDto(browseRecord);
        return result;
    }

}
